const { DataTypes } = require('sequelize');

module.exports = (sequelize) => {
  const RoomTag = sequelize.define('RoomTag', {
    id: {
      type: DataTypes.INTEGER,
      primaryKey: true,
      autoIncrement: true,
      comment: '标签ID'
    },
    room_id: {
      type: DataTypes.INTEGER,
      allowNull: false,
      comment: '房间ID'
    },
    tag_name: {
      type: DataTypes.STRING(50),
      allowNull: false,
      comment: '标签名称'
    }
  }, {
    tableName: 'room_tag',
    timestamps: false // 这个表没有时间戳字段
  });

  // 添加关联关系
  RoomTag.associate = (models) => {
    RoomTag.belongsTo(models.Room, { 
      foreignKey: 'room_id'
    });
  };

  return RoomTag;
}; 